<template>
    <h2>登录页面</h2>
    <table>
        <tr>
            <td>用户名</td>
            <td>
                <input type="text" placeholder="请输入用户名" v-model="info.Mname">
            </td>
        </tr>
        <tr>
            <td>密码</td>
            <td>
                <input type="password" placeholder="请输入密码" v-model="info.Pwd">
            </td>
        </tr>
        <tr>
            <td colspan="2" style="text-align:center">
                <input type="button" value="登录" @click="login"/>
            </td>
        </tr>
    </table>
</template>

<script setup lang="ts">
    import {ref} from 'vue'
    import axios from 'axios'
   
    const info=ref({
        Mname:"",
        Pwd:""
    })

    const login=()=>{
        axios.get('https://localhost:7234/api/MemberContorller/MemberLogin',
        {
            params:{
                Mname:info.value.Mname,
                Pwd:info.value.Pwd
            }
         })
         .then(res=>{
            if(res.data>0)
            {
                alert('登录成功');
            }
         })
         .catch(error=>{
            console.log(error);
         })
    }
</script>